<test>

    <create_query>
        CREATE TABLE lwd_test (
            id UInt64,
            value String,
        ) ENGINE=MergeTree() ORDER BY id;
    </create_query>

    <!-- Fill the table with relatively big values -->
    <fill_query>
        INSERT INTO lwd_test SELECT number, randomString(100) FROM system.numbers LIMIT 10000000;
    </fill_query>

    <fill_query>
        OPTIMIZE TABLE lwd_test FINAL;
    </fill_query>

    <settings>
        <max_threads>1</max_threads>
        <mutations_sync>1</mutations_sync>
    </settings>

    <!-- delete most of the rows -->
    <fill_query>
        DELETE FROM lwd_test WHERE id &lt; 9999999;
    </fill_query>

    <!-- get the first remaining row -->
    <query>SELECT id, length(value) FROM lwd_test ORDER BY id LIMIT 1</query>

    <drop_query>DROP TABLE lwd_test</drop_query>

</test>
